package com.quwan.common;

import com.quwan.common.exception.ExpCode;
import com.quwan.common.exception.ResponseException;
import org.springframework.lang.Nullable;

/**
 * @author quan
 * @date 2021-10-30 12:37
 */

public abstract class Check {
    public static void notNull(@Nullable Object object, ExpCode e) {
        if (object == null) {
            throw new ResponseException(e.getCode(),e.getMsg());
        }
    }
    public static void state(boolean expression, ExpCode e) {
        if (!expression) {
            throw new ResponseException(e.getCode(),e.getMsg());
        }
    }
}
